package oldmodifiers;

import inputs.Input;

import java.util.List;

public class Average extends Modifier implements Runnable{
	
	boolean running;
	int total, count;
	public Average(List<Input> inputs)
	{
		//super(inputs);
		running = false;
		total = 0;
		count = 0;
	}

	protected void Update()
	{
		if (!running)
		{
			total = 0;
			count = 0;
		}
		for (Input input : inputs)
		{
			total += input.getValue();
			count++;
		}
		
		this.value = total / count;
	}

	public boolean getRun() {
		return running;
	}

	public void setRun(boolean run) {
		this.running = run;
	}

	protected void AccountForInputs() {
		int minTotal = 0;
		int maxTotal = 0;
		int count = 0;
		
		for(Input input : inputs)
		{
			minTotal += input.getMin();
			maxTotal += input.getMax();
			count++;
		}
		
		min = minTotal / count;
		max = maxTotal / count;
	}
}
